" The following prevents the file from being executed multiple times 
" I am not sure why that happens 
if exists("did_load_filetypes") 
   finish 
endif 

" below is a function definition. 
" '!' means to that this function will overwrite functions with the same 
" name if they exist 
fun! PySkel() 
    " 0 put means put on the very first line. otherwise vim will start 
    " with second. 
    " You have to use single quotes; 
    " Most of escape characters didn't work for me 
    let author = "Chen Wei"
    let company = "baike"
    let info = "#!/usr/bin/env python \n"
            \."#_*_ encoding: utf-8 _*_ \n\n"
            \."'''\n"
            \."Description:\t \n\t\t\t\t\t\t\n"
            \."'''\n\n"
            \."__author__ = '".author."'\n"
            \."__version__ = '0.1'\n"
            \."__date__ = '".strftime("%Y-%m-%d %H:%M")."'\n\n\n"
    0 put =info

    put ='def main():' 
    put ='   pass' 
    put ='' 
    put ='if __name__ == \"__main__\":' 
    put ='   main()' 
endfun 

"defining a new 'auto command' group 
augroup newPy 
        "when buffer for a new file that matches *.py is created, 
        " run  PySkel() 
   au BufNewFile *.py call PySkel() 
augroup END
